const Koa = require('koa');
const Router = require('koa-router');
const router = new Router();
const { default: newPage } = require('./apis/newPage');
const fs = require('fs');
const app = new Koa();
const apis = fs.readdirSync(__dirname + '/apis');
apis.forEach(element => {
    let module = require(`${__dirname}/apis/${element}`);
    router.use(`/${element.replace('.js', '')}`, module.routes(), module.allowedMethods());
});

app.use(router.routes());

app.listen(3000);